<!--{template ADMIN_DIRECTORY/tpl/admin_header}-->
<div class="page_title">
    <h1>{$model_info['model_name']}{$_lang['manage']}</h1>
    <div class="tool">
        <a href="index.php?do=model&model_id={$model_id}&view=list" class="here">{$_lang['task_list']}</a>
		<!--<a href="index.php?do=model&model_id={$model_id}&view=config">{$_lang['task_config']}</a>-->
    </div>
</div>
<div class="box search p_relative">
    <div class="title">
        <h2>{$_lang['search']}</h2>
    </div>
    <div class="detail" id="detail">
        <form action="index.php?do={$do}&model_id={$model_id}&view=list" method="post" id=frm_user_search>
        	<input type="hidden" value="{$page}" name="page">
        	 <table cellspacing="0" cellpadding="0">

                <tbody>
                    <tr>
                        <th>
                            {$_lang['task']}
                        </th>
                        <td>
                            <input type="text" value="{$task_id}" name="w[task_id]" class="txt" onkeyup="clearstr(this);"/>
                        </td>
                        <th>
                            {$_lang['task_title']}
                        </th>
                        <td>
                            <input type="text" value="{$task_title}" name="w[task_title]" class="txt" />{$_lang['search_by_like']}
                        </td>
                      <th></th><td> <button class="pill" type="submit" value={$_lang['search']} name="sbt_search">
                                <span class="icon magnifier">&nbsp;</span>{$_lang['search']}
                              </button></td>
                    </tr>
                    <tr>
                    	  <th>
                            {$_lang['task_status']}
                        </th>
                        <td>
                            <select class="ps vm" name="w[task_status]" id="catid" onchange="statusJump(this.value)">
                                <option value="" {if !$w[task_status]}selected="selected"{/if}>全部</option>
                                {loop $task_status $key $v}
                                {if $key>=1}
								<option value="$key" {if $w[task_status]==$key}  selected="selected"{/if}>$v  </option>
                                {/if}
                                {/loop}
                            </select>
                        </td>
                        <th>
                           {$_lang['result_order']}
                        </th>
                        <td>
                           <select name="ord[]" id="ord1">
                           <option value="task_id" {if $ord[0]=='task_id' or !isset($ord[0])} selected="selected"{/if}>{$_lang['default']}{$_lang['order']}</option>
                           <option value="end_time" {if $ord[0]=='end_time' } selected="selected"{/if}>{$_lang['expiration_time']}</option>
                      </select>
                      <select name="ord[]" onchange="orderJump(this.value)">
                            <option {if $ord[1]=='desc' or !isset($ord[1])}selected="selected" {/if} value="desc">{$_lang['desc']}</option>
                            <option {if $ord[1]=='asc'}selected="selected" {/if} value="asc">{$_lang['asc']}</option>
                      </select>
                       </td>
                        <th>
                     {$_lang['list_result']}
                         </th>
                        <td>
                            <select name="w[page_size]" onchange="pageJump(this.value)">
                               <option value="10" {if $w[page_size]=='10'}selected="selected"{/if}>{$_lang['page_size']}10</option>
                               <option value="20" {if $w[page_size]=='20'}selected="selected"{/if}>{$_lang['page_size']}20</option>
                               <option value="30" {if $w[page_size]=='30'}selected="selected"{/if}>{$_lang['page_size']}30</option>
                             </select>

                           </td>
                        </tr>
                  </tbody>
            </table>
        </form>
    </div>
 </div>
<!--搜索结束-->
<div class="box list">
    <div class="title">
        <h2>{$_lang['task_manage']}</h2>
    </div>
     <div class="detail">
        <form action="index.php?do={$do}&model_id={$model_id}&view=list" method="post" id="frm_list">
		 	<input type="hidden" value="{$page}" name="page">
		 	<input type="hidden" name="w[page_size]" value="{$page_size}">
		 	<div id="ajax_dom">
		 	<input type="hidden" value="{$page}" name="page"/>
		  <table cellpadding="0" cellspacing="0">
             <tbody>
                 <tr>
                    <th>
	编号
</th>
                      <th width="22%">
                   {$_lang['task_title']}
                       </th>
					    <th width="20%">
                     {$_lang['task_cash']}
                       </th>
                           <th width="10%">
                      {$_lang['pub_name']}
                       </th>

                       <th width="9%">
                        {$_lang['task_status']}
                        </th>
                     <!--   <th width="14%">
                     {$_lang['expiration_time']}
                        </th>-->
                        <th width="20%">
                       {$_lang['operate']}
                        </th>
                     </tr>
                       {loop $task_arr $k $v}
                         <tr class="item">

                            <td class="td25">
                              {$v[task_id]}
                             </td>
                           <td >
                                <a href="../index.php?do=task&id={$v['task_id']}" target="_blank">
                                	<!--{eval echo(kekezu::cutstr($v[task_title],36));}--></a>
									{if $v[is_top]==1}<font color="red">{$_lang['recommended']}</font>{/if}
                            </td>
							<td>

                                {c:$cash_rule_arr[$v[task_cash_coverage]][start_cove]}-{c:$cash_rule_arr[$v[task_cash_coverage]][end_cove]}
                            </td>
                            <td>
                               {$v[username]}
                             </td>

                            <td>
                                {if $v[task_status]==0}{$_lang['without_payment']}{elseif $v[task_status]==1}{$_lang['pending']}{elseif $v[task_status]==2}{$_lang['in_bidding']}{elseif $v[task_status]==3}{$_lang['standard_selection_in']}
								{elseif $v[task_status]==4}{$_lang['to_be_managed']}{elseif $v[task_status]==6}{$_lang['delivery_of']}{elseif $v[task_status]==7}{$_lang['freezing_process']}
								{elseif $v[task_status]==8}{$_lang['has_ended']}{elseif $v[task_status]==9}{$_lang['has_fail']}{elseif $v[task_status]==10}{$_lang['nopass']}
								{elseif $v[task_status]==11}{$_lang['in_the_arbitration']}{/if}
                            </td>

                             <td>
                               <!--
                               {if $v[task_status]==1||$v[task_status]==0}
							  		<a href="index.php?do=model&model_id=$model_id&view=list&ac=pass&task_id={$v[task_id]}&page={$page}" onclick="return cpass(this,'',1);" class="button"><span class="cog icon"></span>审核通过</a>
      								<a href="index.php?do=model&model_id=$model_id&view=list&ac=nopass&task_id={$v[task_id]}&page={$page}" onclick="return cpass(this,'',2);" class="button"><span class="cross icon"></span>审核失败</a>
								{/if}
								 -->
                             	{if $v[task_status]==1||$v[task_status]==0}
							  		<a href="index.php?do=model&model_id=$model_id&view=list&ac=pass&task_id={$v[task_id]}&page={$page}" onclick="return cpass(this,'',1);" class="button"><span class="cog icon"></span>审核通过</a>
      								<a href=javascript:lookinfo("index.php?do=model&model_id=$v['model_id']&view=list&task_id=$v['task_id']&ac=nopass&page={$page}&uid={$v['uid']}"); class="button"><span class="cross icon"></span>审核失败</a>
      								<!-- <a href="index.php?do=model&model_id=$model_id&view=list&ac=nopass&task_id={$v[task_id]}&page={$page}" onclick="return cpass(this,'',2);" class="button"><span class="cross icon"></span>审核失败</a> -->
								{/if}
									<a href="index.php?do=model&model_id=$model_id&view=edit&task_id={$v[task_id]}&page={$page}" class="button dbl_target"><span class="pen icon"></span>查看</a>
								{if in_array($v[task_status],array('8','9','10'))}
									<a href="index.php?do=model&model_id=$model_id&view=list&ac=del&task_id={$v[task_id]}&page={$page}" onclick="return cdel(this);" class="button"><span class="trash icon"></span>{$_lang['delete']}</a>
						   		 {/if}
						 {if !in_array($v['task_status'],array('0','1','8','9','10'))}
						<a href="#" class="button" onclick="stoptask($v[task_id]);">结束任务</a>
						{/if}
							</td>
                         </tr>
						{/loop}
						<tr>
                           <td colspan="7">
                               {if $pages[page]}<div class="page fl_right">{$pages[page]}</div>{/if}
                           
                         </td>
                   </tr>
                </tbody>
        </table></div>
       </form>
     </div>
</div>
<!--{template ADMIN_DIRECTORY/tpl/admin_footer}-->
<script type="text/javascript">
	var url = '{$url_str}';
	function statusJump(task_status){
		window.location.href = url+'&w[task_status]='+task_status;
	}
	function orderJump(value){
		var ord1 = $("#ord1").children("option:selected").val();//selected的值
		window.location.href= url+'&ord[0]='+ord1+'&ord[1]='+value;
	}
	function pageJump(value){
		window.location.href = url+'&page_size='+value;
	}
	function lookinfo(url){
		art.dialog.open(url,{
			title:"审核不通过的原因",
			height:400,
			width:600,
			closeFn:function (){
						var ispass=art.dialog.data('ispass');
						if(ispass=='ok'){
						var reason = art.dialog.data('reason');
						var username = art.dialog.data('username');
						var title = art.dialog.data('title');
						art.dialog.data('ispass','no');
					 	window.location.href=url+'&is_submit=1'+'&reason='+reason+'&username='+username+'&title='+title; 
						} 
						
			}
			},false); 
	}
	function stoptask(task_id){
		art.dialog.open('index.php?do=model&model_id=5&view=list&ac=settask&task_id='+task_id,{
			title:"请输入结束任务原因",
			height:260,
			width:450,
			closeFn:function (){
						var ispass=art.dialog.data('ispass');
						var content=art.dialog.data('content');
						if(ispass=='ok'){
							art.dialog.data('ispass','no');
							window.location="index.php?do=model&model_id=5&view=list&ac=stoptask&content="+content+"&task_id="+task_id;
						}
				}
			},false);
	}
</script>